<template>
  <div>
    <custom-table
      :columns="tableColumns"
      :action-url="'/pole/warning/list'"
      :has-search="true"
      :search-data="searchData"
      :form-option-items="formOptionItems"
    >
      <!-- 处置状态 -->
      <template #handleStatus="{row}">
        <span v-if="row.handleStatus===0">未派单</span>
        <span v-if="row.handleStatus===1">已派单</span>
        <span v-if="row.handleStatus===2">已接单</span>
        <span v-if="row.handleStatus===3">已完成</span>
      </template>
    </custom-table>
  </div>
</template>

<script>
import CustomTable from '@/components/CustomTable2.vue'
export default {
  components: { CustomTable },
  data() {
    return {
      searchData: [
        { label: '一体杆名称', type: 'input', name: 'poleName' },
        { label: '一体杆编号', type: 'input', name: 'poleNumber' },
        { label: '处置状态', type: 'select', name: 'handleStatus', options: [{ label: '全部', value: ' ' }, { label: '未派单', value: '0' }, { label: '已派单', value: '1' }, { label: '已结单', value: '2' }, { label: '已完成', value: '3' }] }
      ],
      tableColumns: [
        { label: '一体杆名称', prop: 'poleName' },
        { label: '一体杆编号', prop: 'poleNumber' },
        { label: '故障类型', prop: 'errorType' },
        { label: '处置状态', prop: 'handleStatus', custom: true },
        { label: '告警时间', prop: 'warningTime' },
        { label: '操作', prop: 'operate', operations: [
          // { label: '派单', handler: { name: 'edit', detailUrl: '', url: '/pole/info' }},
          { label: '详情', handler: { path: '/warn/detail/' }},
          { label: '删除', handler: { name: 'delete', url: '/pole/warning/', title: '是否确认删除当前告警记录?' }}
        ] }
      ],
      formOptionItems: [
        { type: 'text', label: '一体杆名称', name: 'poleName' },
        { type: 'text', label: '一体杆编号', name: 'poleNumber', edit: { prop: { disabled: 'true' }}},
        { type: 'text', label: '一体杆IP', name: 'poleIp', rule: { pattern: /^(\d{1,3}\.){3}\d{1,3}$/, message: '请输入正确的IP', trigger: 'blur' }},
        { type: 'select', label: '关联区域', name: 'areaId', handler: { label: 'name', value: 'id', url: '/park/all/enterprise' }},
        { type: 'select', label: '一体杆类型', name: 'poleType',
          options: [
            { value: 'entrance', label: '入口' }, { value: 'export', label: '出口' }
          ]
        }
      ]
    }
  }
}
</script>

<style>
</style>
